package org.wattdepot.cli.command;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.wattdepot.cli.processor.CommandLineInterface;
import static org.junit.Assert.assertTrue;

/**
 * TotalPower command test case, evaluates command against known values.
 * 
 * @author Bao Huy Ung, Edward Meyer
 */
public class TestTotalPower extends CommandLineInterface {

  /**
   * Tests if command TotalPower return valid known values.
   */
  @Test
  public void testTotalPower() {

    List<String> args = new ArrayList<String>();
    boolean totalCheck = false;
    args.add("totalpower");
    args.add("SIM_WAIAU");
    args.add("2009-11-15T12:13:00.000-10:00");
    args.add("fueltype");
    args.add("LSFO");

    TotalPower power = new TotalPower();

    String total = power.doCommand(args);
    // check against LSFO known value
    if (total.equalsIgnoreCase("1.76E8")) {
      totalCheck = true;
    }

    System.out.println("Checking against known LSFO value Source: SIM_WAIAU"
        + " on 2009-11-15T12:13:00.000-10:00");
    assertTrue("Checking against known LSFO value", totalCheck);

    // check against known waste value
    args.set(1, "SIM_IPP");
    args.set(2, "2009-10-26T18:15:00.000-10:00");
    args.set(4, "Waste");

    total = power.doCommand(args);

    if (total.equalsIgnoreCase("4.6E7")) {
      totalCheck = true;
    }
    else {
      totalCheck = false;
    }

    System.out.println("Checking against known Waste value Source: SIM_IPP"
        + " on 2009-10-26T18:15:00.000-10:00");
    assertTrue("Checking against known waste value", totalCheck);

  }
}
